package com.sxl.ocr.ocronnx.service;

import com.benjaminwan.ocrlibrary.TextBlock;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.codec.multipart.FilePart;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;

/**
 * description:
 * author: shenxiaolong
 * date: 2021/1/27  14:39
 */
public interface OCRService {

    OcrResultVo getOnnxOcrResult(Path path, int imgResize);

    OcrResultVo getOnnxOcrResult(File file, int imgResize);

    String getNcnnOcrResult(FilePart filePart);

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    class OcrResultVo {
        private ArrayList<TextBlock> textBlocks;
        private String strRes;
        private double dbNetTime;
        private double detectTime;
    }
}


